package com.stxx;

import cn.hutool.json.JSONUtil;
import com.influxdb.client.domain.Query;
import com.influxdb.client.domain.WritePrecision;
import com.influxdb.client.write.Point;
import org.noear.snack.core.Options;

/**
 * @author Fuzhenlei
 * @date 2025/01/16 11:58
 */
public class Test {

    public void abc(Object b){
        System.out.println(JSONUtil.toJsonStr(b));
    }
    public static void abc2(Object b){
        System.out.println(JSONUtil.toJsonStr(b));
    }
    public static void main(String[] args) {
        String aaa = "{\"body\":{\"a\":\"1\"},\"pathVars\":[{\"name\":\"a\",\"type\":\"string\",\"minLength\":12}]}";
        Options options =Options.serialize();
//        options.addDecoder(IEnum.class,(source, clazz)->{
//            Class<? extends  IEnum> enumClass = (Class<? extends IEnum>) clazz;
//            return IEnum.of(enumClass,source.getRawString());
//        });

//        Point point = Point
//                .measurement(data.getMod())
//                .addTag("di",event.getDeviceName())
//                .addTag("gw",event.getGatewayId())
//                .time(data.getTimestamp(), WritePrecision.MS);
//        point.addField()


//        CompiledScript script = ScriptUtil.compile("a+b");
//        CompiledScript script1 = ScriptUtil.compile("t.abc2({\"c\":1})");
//        // 创建脚本引擎管理器
//        try {
//            Bindings b = script1.getEngine().createBindings();
//            Test t = new Test();
//            // 执行简单的 JavaScript 代码
//            Object result = script1.eval(b);
//            System.out.println("Result of the script:" + result);
//        } catch (ScriptException e) {
//            e.printStackTrace();
//        }

    }
}
